{extend name="common@base/common" /}

{block name="body"}
{include file="common@base/_nav" /}
	<div class="cf">
		<div class="fl">
		{empty name="model.extend"}
			<div class="tools">
				{php} $add_url = U('add',array('uid'=>input('uid')));{/php}<a class="btn" href="{$add_url}">新 增</a>
				{php} $del_url = U('del',array('uid'=>input('uid')));{/php}<button class="btn ajax-post confirm" target-form="ids" url="{$del_url}">删 除</button>
			</div>
		{/empty}
		</div>
	</div>


    <!-- 数据列表 -->
    <div class="data-table">
        <div class="data-table table-striped">
            <table>
                <!-- 表头 -->
                <thead>
                    <tr>
                        {if condition="$check_all"}<th class="row-selected row-selected">
                            <input class="check-all" type="checkbox">
                        </th>{/if}
                        {php}if(isset($list_grids)){{/php}
                        {volist name="list_grids" id="field"}
                  <th {php} if(isset($field['width']) && !empty($field['width'])) { is_numeric($field['width']) && $field['width'] .= '%'; echo 'width="'.$field['width'].'"'; } {/php} >{$field.title}</th>
                        {/volist}
                        {php}}{/php}
                    </tr>
                </thead>

                <!-- 列表 -->
                <tbody>
                    {volist name="list_data" id="data"}
                        <tr>
                  {if condition="$check_all"}<td><input class="ids regular-checkbox" type="checkbox" value="{$data['id']}" name="ids[]" id="check_{$data['id']}"><label for="check_{$data['id']}"></label></td>{/if}
                            {volist name="list_grids" id="grid"}
                            {if condition="(isset($grid.raw) && $grid.raw == 1) OR (isset($grid.come_from) && $grid.come_from == 1)" }
                            <td style="overflow: auto;white-space: normal ">{$data[$key]|raw}</td>{else /}
                            <td>{$data[$key]|raw}</td>{/if}
                            {/volist}
                        </tr>
                    {/volist}
                </tbody>
            </table>
        </div>
    </div>
    <div class="page">
        {$_page|raw|default=''}
    </div>
{/block}

{block name="script"}
<script type="text/javascript">
$(function(){
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		 url = change_search_url(url);
		window.location.href = url;
	});

    //回车自动提交
    $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });

})
</script>
{/block}
